<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function base(num) {
            const stack = [];
            let s = '';
            while (num >= 2) {
                if (num % 2 == 1) {
                    stack.push(1);
                } else {
                    stack.push(0);
                }
                num = Math.floor(num/2);
            }
            if (num % 2 == 0) {
                stack.push(0);
            } else {
                stack.push(1)
            }
            while (stack.length) {
                s += stack.pop();
            }

            return s;
        }
        

        let num = 100;
        console.log(base(100));
    </script>
</body>
</html>